package org.wxd.bi.po;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wxd.batis.struct.DbColumn;
import org.wxd.batis.struct.DbTable;
import org.wxd.lang.ConvertUtil;
import org.wxd.lang.save.ObjectBase;

import java.io.Serializable;

/**
 * @author: Troy.Chen(無心道, 15388152619)
 * @version: 2021-10-21 14:36
 **/
@DbTable(comment = "全局信息")
public class GlobInfo extends ObjectBase implements Serializable {

    private static final long serialVersionUID = 1L;
    private static final Logger log = LoggerFactory.getLogger(GlobInfo.class);

    @DbColumn(key = true)
    private String key;

    @DbColumn(index = true)
    private String value;

    public String getKey() {
        return key;
    }

    public GlobInfo setKey(String key) {
        this.key = key;
        return this;
    }

    public String getValue() {
        return value;
    }

    public GlobInfo setValue(String value) {
        this.value = value;
        return this;
    }

    public <R> R valueOf(Class<R> clazz) {
        return (R) ConvertUtil.changeType(value, clazz);
    }

    /**
     * 赋值
     *
     * @param source
     */
    public void ofValue(Object source) {
        this.key = String.valueOf(source);
    }

}
